//
//  RootViewController.m
//  MarryAid
//
//  Created by 龚光明 on 13-1-8.
//  Copyright (c) 2013年 marry aid. All rights reserved.
//

#import "RootViewController.h"
#import "AddNormalActionViewController.h"

@interface RootViewController ()

@end

@implementation RootViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
        self.title = @"主页";
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
	// Do any additional setup after loading the view.
    UIButton *rightButton = [UIButton buttonWithType:UIButtonTypeCustom];
    rightButton.frame = CGRectMake(0, 0, 47, 30);
    [rightButton setBackgroundImage:[UIImage imageNamed:@"click_topbtn.png"] forState:UIControlStateNormal];
    [rightButton setBackgroundImage:[UIImage imageNamed:@"down_topbtn.png"] forState:UIControlStateHighlighted];
    [rightButton addTarget:self action:@selector(comeintoAddNormal) forControlEvents:UIControlEventTouchUpInside];
    
    UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(4.f, 4.f, 40.f, 20.f)];
    title.text = @"进入";
    title.textAlignment = UITextAlignmentCenter;
    title.backgroundColor = [UIColor clearColor];
    title.textColor = [UIColor whiteColor];
    title.font = SmallFont12;
    [rightButton addSubview:title];
    
    UIBarButtonItem *rightItem = [[UIBarButtonItem alloc] initWithCustomView:rightButton];
    self.navigationItem.rightBarButtonItem = rightItem;
}

-(void)comeintoAddNormal
{
    AddNormalActionViewController *addActionView = [[AddNormalActionViewController alloc] init];
    [self.navigationController pushViewController:addActionView animated:YES];

}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
